<?php

namespace plugins\module_config\controller;

use app\common\lib\user_operate\ModuleOperate as MO; //引入此类

use cmf\controller\PluginAdminBaseController;

/**

 * 模块列表

 */

class ModuleListController extends PluginAdminBaseController
{

    /**

     * 模块列表

     */

    public function index()
    {

        $data = $this->request->param();

        $mo = new MO();
        //模块列表
        $module_list = $mo->getModuleList();

        if ($module_list['status'] != 'success') {
            $list = [];
        } else {
            $list = $module_list['data'];
        }

        //模块名搜索
        if (!empty($data['search'])) {
            $search = $data['search'];
            $list = array_filter($list, function ($t) use ($search) {return (strpos($t['title'], $search) !== false);});
        }

        $this->assign('module_list', $list);
        $this->assign('list', $list);
        $this->assign('data', $data);
        return $this->fetch('module_list/index');

    }

}
